//
//  MyScrollView.m
//  homework_UInavigationController
//
//  Created by dllo on 16/6/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MyScrollView.h"

@implementation MyScrollView

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (self) {
        [self setProperty];
    }
    return self;
}

/**设置属性*/
-(void)setProperty
{
    self.showsHorizontalScrollIndicator = NO;
    
    self.showsVerticalScrollIndicator = NO;
    
    self.pagingEnabled = YES;
    
    self.bounces = YES;
}

/**添加图片*/
-(void)addPicture:(NSArray<UIImage *> *)pictureArray
{
    CGSize size = self.frame.size;
    
    self.contentSize = CGSizeMake(size.width * pictureArray.count, size.height);
    
    for (int i = 0; i < pictureArray.count; i++) {
        
        UIImageView *imageView = [[UIImageView alloc]initWithImage:pictureArray[i]];
        
        imageView.frame = CGRectMake(i * size.width, 0, size.width, size.height);
        
        [self addSubview:imageView];
        
        [imageView release];
        
    }
    
    
}

@end
